<template>
  <div class="room">
    <div class="container">
      <h1>订婚宴桌席安排</h1>
      <div class="tables">
        <div class="table">
          <h2 class="table-name">客桌1（10人）</h2>
          <div class="seats2">
            <Seat v-for="index in 10" :key="index" />
          </div>
        </div>
        <div class="middle">
          <div class="table">
            <h2 class="table-name">客桌2（10人）</h2>
            <div class="seats2">
              <Seat v-for="index in 10" :key="index" />
            </div>
          </div>
          <div class="table">
            <h2 class="table-name">客桌2（10人）</h2>
            <div class="seats2">
              <Seat v-for="index in 10" :key="index" />
            </div>
          </div>
        </div>
        <div class="table">
          <h2 class="table-name">主桌（14人）</h2>
          <div class="seats">
            <Seat v-for="index in 14" :key="index" />
          </div>
        </div>
      </div>
    </div>
    <div class="door"></div>
  </div>
</template>

<script setup lang="ts">
import Seat from './components/Seat.vue'
</script>

<style scoped>
.room {
  position: relative;
  width: 1800px;
  height: 1000px; /* 房间高度 */
  background-color: #f0f0f0; /* 房间背景色 */
  border: 2px solid #ccc; /* 房间边框 */
  border-radius: 10px;
  padding: 20px;
}

.container {
  text-align: center;
  padding: 20px;
}

.tables {
  display: flex;
  justify-content: space-around; /* 三个桌子均匀分布 */
  margin-top: 40px;
  align-items: center; /* 居中对齐 */
}

.middle {
  display: flex;
  flex-direction: column; /* 竖向排列 */
  align-items: center; /* 居中对齐 */
}

.table {
  position: relative;
  display: inline-block;
  width: 400px; /* 圆桌的宽度 */
  height: 400px; /* 圆桌的高度 */
}

.table-name {
  position: absolute;
  top: 50%; /* 桌子名称位置 */
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: bold;
  background-color: rgba(255, 255, 255, 0.8);
  padding: 5px 10px;
  border-radius: 5px;
}

.seats {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.seats > * {
  position: absolute; /* 绝对定位 */
}

.seats2 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.seats2 > * {
  position: absolute; /* 绝对定位 */
}

/* 主桌（14人）座位布局 */
.seats > :nth-child(1) { transform: rotate(0deg) translate(160px) rotate(0deg); }
.seats > :nth-child(2) { transform: rotate(25.7deg) translate(160px) rotate(-25.7deg); }
.seats > :nth-child(3) { transform: rotate(51.4deg) translate(160px) rotate(-51.4deg); }
.seats > :nth-child(4) { transform: rotate(77.1deg) translate(160px) rotate(-77.1deg); }
.seats > :nth-child(5) { transform: rotate(102.8deg) translate(160px) rotate(-102.8deg); }
.seats > :nth-child(6) { transform: rotate(128.5deg) translate(160px) rotate(-128.5deg); }
.seats > :nth-child(7) { transform: rotate(154.2deg) translate(160px) rotate(-154.2deg); }
.seats > :nth-child(8) { transform: rotate(179.9deg) translate(160px) rotate(-179.9deg); }
.seats > :nth-child(9) { transform: rotate(205.6deg) translate(160px) rotate(-205.6deg); }
.seats > :nth-child(10) { transform: rotate(231.3deg) translate(160px) rotate(-231.3deg); }
.seats > :nth-child(11) { transform: rotate(257deg) translate(160px) rotate(-257deg); }
.seats > :nth-child(12) { transform: rotate(282.7deg) translate(160px) rotate(-282.7deg); }
.seats > :nth-child(13) { transform: rotate(308.4deg) translate(160px) rotate(-308.4deg); }
.seats > :nth-child(14) { transform: rotate(334.1deg) translate(160px) rotate(-334.1deg); }

/* 客桌（10人）座位布局 */
.seats2 > :nth-child(1) { transform: rotate(0deg) translate(130px) rotate(0deg); }
.seats2 > :nth-child(2) { transform: rotate(36deg) translate(130px) rotate(-36deg); }
.seats2 > :nth-child(3) { transform: rotate(72deg) translate(130px) rotate(-72deg); }
.seats2 > :nth-child(4) { transform: rotate(108deg) translate(130px) rotate(-108deg); }
.seats2 > :nth-child(5) { transform: rotate(144deg) translate(130px) rotate(-144deg); }
.seats2 > :nth-child(6) { transform: rotate(180deg) translate(130px) rotate(-180deg); }
.seats2 > :nth-child(7) { transform: rotate(216deg) translate(130px) rotate(-216deg); }
.seats2 > :nth-child(8) { transform: rotate(252deg) translate(130px) rotate(-252deg); }
.seats2 > :nth-child(9) { transform: rotate(288deg) translate(130px) rotate(-288deg); }
.seats2 > :nth-child(10) { transform: rotate(324deg) translate(130px) rotate(-324deg); }

.door {
  position: absolute;
  left: 0;
  top: 50%;
  width: 20px; /* 门的宽度 */
  height: 100px; /* 门的高度 */
  background-color: #8B4513; /* 门的颜色 */
  transform: translateY(-50%);
}
</style>